#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2020/7/19 10:32|10:32
# @Author  : yangdingyi
# @File    : 2020-07-19.1.5464.换酒问题
# @Software: PyCharm


class Solution:
    def numWaterBottles(self, numBottles: int, numExchange: int) -> int:
        ans, num = numBottles, numBottles
        while num >= numExchange:
            ans += num // numExchange
            num = num // numExchange + num % numExchange
        return ans
